#ifndef GAMESCENE_H
#define GAMESCENE_H

#include <QWidget>
#include <QTimer>
#include <QImage>
#include <QList>

class WorldSimulator;
class Plane;
class GameScene : public QWidget
{
    Q_OBJECT

public:
    GameScene(QWidget *parent = nullptr);
    ~GameScene();

public slots:
    void setKpx(double kpx);
    void setKix(double kix);
    void setKdx(double kdx);
    void setKpy(double kpy);
    void setKiy(double kiy);
    void setKdy(double kdy);
    void setWindOn(int hasWind);

private slots:
    void createEdge();
    void step();

private:
    QTimer *timer;
    QImage background;
    QPointF target;
    WorldSimulator *world;
    Plane *plane;
    long frames;

    int windForceId;

    float kpx, kix, kdx, ixItem, lastxInput;
    float kpy, kiy, kdy, iyItem, lastyInput;

    QList<float> xValues;
    QList<float> yValues;

    QPointF stoneGeneratePos;
    QPointF stoneDirectionPos;

    static const float scaleFactor;

protected:
    void paintEvent(QPaintEvent *event) override;
    void mousePressEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
};
#endif // GAMESCENE_H
